package com.qf.springboot.vo;

import com.qf.springboot.utils.Constants;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResultVo {
    private Integer code;
    private String message;
    private Object data;

    public ResultVo(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public static ResultVo fail(String msg) {
        ResultVo resultVo = new ResultVo();
        resultVo.setCode(Constants.FAIL_CODE);
        resultVo.setMessage(msg);
        return resultVo;
    }

    public static ResultVo success(String msg) {
        ResultVo resultVo = new ResultVo();
        resultVo.setCode(Constants.SUCCESS_CODE);
        resultVo.setMessage(msg);
        return resultVo;
    }
}
